"""
球队申请相关 Schema
"""
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional
from datetime import datetime


class TeamApplicationCreate(BaseModel):
    """创建球队申请"""
    teamId: str = Field(..., description="球队ID")
    message: Optional[str] = Field(None, max_length=500, description="申请留言")


class TeamApplicationReview(BaseModel):
    """审批球队申请"""
    applicationId: str = Field(..., description="申请ID")
    approved: bool = Field(..., description="是否通过")
    rejectReason: Optional[str] = Field(None, max_length=500, description="拒绝原因")


class TeamApplicationResponse(BaseModel):
    """球队申请响应"""
    id: str
    teamId: str
    teamName: Optional[str] = None
    applicantId: str
    applicantName: Optional[str] = None
    applicantAvatar: Optional[str] = None
    status: str  # pending, approved, rejected, cancelled
    message: Optional[str] = None
    rejectReason: Optional[str] = None
    reviewedBy: Optional[str] = None
    reviewedAt: Optional[datetime] = None
    createdAt: Optional[datetime] = None
    updatedAt: Optional[datetime] = None
    
    model_config = ConfigDict(
        from_attributes=True,
        populate_by_name=True
    )

